package com.gareve.twoSides.screens;

import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.InputMultiplexer;
import com.badlogic.gdx.Screen;
import com.badlogic.gdx.input.GestureDetector;
import com.gareve.twoSides.TwoSidesGame;
import com.gareve.twoSides.input.GameInputListener;
import com.gareve.twoSides.input.InputStatus;
import com.gareve.twoSides.models.GameWorld;
import com.gareve.twoSides.views.GameRenderer;

public class MainScreen implements Screen {
	TwoSidesGame twoSidesGame;
	GameWorld gameWorld;
	GameRenderer gameRenderer;
	InputStatus inputStatus;

	public MainScreen(TwoSidesGame twoSidesGame) {
		this.twoSidesGame = twoSidesGame;
	}

	@Override
	public void render(float delta) {
		gameWorld.update(delta);
		gameRenderer.render();
	}

	@Override
	public void show() {
		gameWorld = new GameWorld();
		gameRenderer = new GameRenderer();
		inputStatus = new InputStatus();

		GameInputListener gameInputListener = new GameInputListener(inputStatus,gameWorld,gameRenderer);
		InputMultiplexer multiplexer = new InputMultiplexer(gameInputListener,new GestureDetector(gameInputListener));
		Gdx.input.setInputProcessor(multiplexer);
		
		gameWorld.setInputStatus(inputStatus);
		gameRenderer.setGameWorld(gameWorld);
	}

	@Override public void resize(int width, int height) {}
	@Override public void hide() {}
	@Override public void pause() {}
	@Override public void resume() {}
	@Override public void dispose() {}
}
